{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DG求解一维Burgers方程"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DG单元操作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dmatrix (generic function with 1 method)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "using DifferentialEquations, Plots, LinearAlgebra, BenchmarkTools, Sundials\n",
    "\n",
    "function legendregausslobatto(m)\n",
    "    # Compute the m'th order Legendre-Gauss-Lobatto quadrature points, x, and weights, w\n",
    "    x = zeros(m+1); w = zeros(m+1)\n",
    "\n",
    "    if m==1\n",
    "        x[1]=-1.0; x[2]=1.0\n",
    "        w[1]= 1.0; w[2]=1.0\n",
    "        return x\n",
    "    end\n",
    "\n",
    "    if m==2\n",
    "        x[1]=-1.0; x[2]=0.0; x[3]=1.0\n",
    "        w[1]= 1/3; w[2]=4/3; w[3]=1/3\n",
    "        return x\n",
    "    end\n",
    "\n",
    "    J = zeros(m-1, m-1); h1 = 2*(0:m-2).+2\n",
    "    aux = broadcast(sqrt, (1:m-2).*((1:m-2).+ 2).*((1:m-2).+1).*((1:m-2).+1)./(h1[1:m-2].+1)./(h1[1:m-2].+3))\n",
    "    J[1:m-2,2:m-1] = Diagonal(2.0 ./(h1[1:m-2].+2).*aux)\n",
    "    J[1,1] = 0.0; J = J + J'\n",
    "\n",
    "    D, V = eigen(J)\n",
    "    i = sortperm(D); x = [-1.0; D[i]; 1.0]\n",
    "    x\n",
    "end\n",
    "\n",
    "function legendre(x,m)\n",
    "    # Evaluate orhonormal m'th order Legendre Polynomial at point x\n",
    "    xp = x\n",
    "    # Initial values P_0(x) and P_1(x)\n",
    "    PL = zeros(m+1, length(xp))\n",
    "    PL[1,:]  .= sqrt(1.0/2.0)\n",
    "    if  m == 0\n",
    "        P = PL'\n",
    "        return P\n",
    "    end\n",
    "    PL[2,:] = sqrt(3.0/2.0)*xp\n",
    "    if  m == 1\n",
    "        P = PL[m+1,:]\n",
    "        return P\n",
    "    end\n",
    "\n",
    "    # Forward recurrence using the symmetry of the recurrence.\n",
    "    aold = sqrt(1.0/3.0)\n",
    "    for i=1:m-1\n",
    "        anew = 2/(2*i+2)*sqrt((i+1)*(i+1)*(i+1)*(i+1)/(2*i+1)/(2*i+3))\n",
    "        PL[i+2,:] = 1/anew*(-aold*PL[i,:] + xp.*PL[i+1,:])\n",
    "        aold = anew\n",
    "    end\n",
    "    P = PL[m+1,:]\n",
    "    return P\n",
    "end\n",
    "\n",
    "function vandermonde(m,r)\n",
    "    # Initialize the 1D Vandermonde Matrix, V_{ij} = phi_j(r_i)\n",
    "    V = zeros(length(r),m+1)\n",
    "    for j in 1:m+1\n",
    "        V[:,j] = legendre(r, j-1)\n",
    "    end\n",
    "    V\n",
    "end\n",
    "\n",
    "function gradlegendre(r, m)\n",
    "    \"\"\"\n",
    "    Evaluate the derivative of the\n",
    "    m'th order Legendre polynomial at points r\n",
    "    \"\"\"\n",
    "    dP = zeros(length(r),1)\n",
    "    if m>0\n",
    "        Ph = -m*r.*legendre(r,m) + m*sqrt((2*m+1)/(2*m-1))*legendre(r,m-1)\n",
    "        dPe = r.^(m+1)*m*(m+1)/2*sqrt((2*m+1)/2)\n",
    "        endp = (broadcast(abs, broadcast(abs,r).-1)) .> 10*2.2204e-16\n",
    "        rh = r.*endp\n",
    "        dP = broadcast(~,endp).*dPe + endp.*Ph./(1.0 .- rh.^2)\n",
    "    end\n",
    "    dP\n",
    "end\n",
    "\n",
    "function dmatrix(m,r,V)\n",
    "    \"\"\"\n",
    "    Purpose : Initialize the (r) differentiation matrices,\n",
    "    evaluated at (r) at order m\n",
    "    \"\"\"\n",
    "    Vr = zeros(length(r),m+1)\n",
    "    for i=0:m\n",
    "       Vr[:,i+1] = gradlegendre(r,i)\n",
    "    end\n",
    "    D = Vr/V\n",
    "    D\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 问题定义"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20-element view(::Array{Float64,2}, 5, :) with eltype Float64:\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0\n",
       " 1.0"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p = 4      # order of polynomials\n",
    "K = 20    # number of elements\n",
    "Np = p+1   # number of points\n",
    "Nface = 2\n",
    "xmin = -1\n",
    "xmax = 1\n",
    "L = xmax - xmin\n",
    "h = L/K\n",
    "ϵ = 0.1\n",
    "r = legendregausslobatto(p)\n",
    "VX = [xmin + i * h for i = 0:K]\n",
    "@inbounds x = ones(p + 1, 1) * VX[1:K]' + 0.5 * (r .+ 1) * (VX[2:K+1] - VX[1:K])'\n",
    "@inbounds V = vandermonde(p, r)\n",
    "@inbounds D = dmatrix(p, r, V)\n",
    "@inbounds Φ = (V * V')\n",
    "@inbounds u0 = @. -tanh((x + 0.5)/(2*ϵ)) + 1.0\n",
    "\n",
    "q  = zeros(Np, K)\n",
    "dq = zeros(Np, K)\n",
    "du = zeros(Np, K)\n",
    "du2 = zeros(Np, K)\n",
    "F_d = zeros(Np, K)\n",
    "F_c = zeros(Np, K)\n",
    "nx = zeros(Np, K)\n",
    "nx[1,:] .= -1\n",
    "nx[end,:] .= 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "rhs (generic function with 1 method)"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "function rhs(u,p,t)\n",
    "    D, Φ, h, du, q, dq, du2, F_d, F_c, nx, xmin, xmax, ϵ = p\n",
    "    \n",
    "    # Define u field differences at faces\n",
    "    du[1,2:end]     = u[1,2:end] - u[end,1:end-1]\n",
    "    du[end,1:end-1] = u[end,1:end-1] - u[1,2:end]\n",
    "\n",
    "    # Impose boundary condition\n",
    "    uin  = -tanh((xmin + 0.5 - t)/(2*ϵ)) + 1.0\n",
    "    uout = -tanh((xmax + 0.5 - t)/(2*ϵ)) + 1.0\n",
    "    du[1,1]     = 2.0*(u[1,1] - uin)\n",
    "    du[end,end] = 2.0*(u[end,end] - uout)\n",
    "    \n",
    "    # Compute q \n",
    "    q = 2.0/h*sqrt(ϵ)*(D*u - Φ*(nx .* du ./ 2.0)) \n",
    "    \n",
    "    # Define q field differences at faces\n",
    "    dq[1,2:end]     = (q[1,2:end]-q[end,1:end-1])/2 \n",
    "    dq[end,1:end-1] = (q[end,1:end-1]-q[1,2:end])/2\n",
    "    \n",
    "    dq[1,1]     = 0\n",
    "    dq[end,end] = 0\n",
    "    \n",
    "    # Evaluate nonlinear flux\n",
    "    du2[1,2:end]     = (u[1,2:end].^2 - u[end,1:end-1].^2) ./ 2.0\n",
    "    du2[end,1:end-1] = (u[end,1:end-1].^2 - u[1,2:end].^2) ./ 2.0\n",
    "\n",
    "    du[1,1]     = u[1,1]^2 - uin^2\n",
    "    du[end,end] = u[end,end]^2 - uout^2\n",
    "    \n",
    "    # Compute maximum velocity\n",
    "    maxvel = maximum(maximum(abs.(u),dims=2))\n",
    "    \n",
    "    # Penalty scaling \n",
    "    τ = 0.0\n",
    "    \n",
    "    # Discontinous flux and correct flux\n",
    "    F_d = u.^2 ./ 2.0 - sqrt(ϵ)*q\n",
    "    F_c = nx .* (du2/2.0 - sqrt(ϵ)*dq) - maxvel/2.0 .* du - τ*sqrt(ϵ).*du \n",
    "    \n",
    "    return -2.0/h*(D*F_d - Φ*F_c) \n",
    "end"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5×20 Array{Float64,2}:\n",
       " 0.131138  0.35037   0.904316  …  0.00012104   4.45282e-5  1.6389e-5 \n",
       " 0.15768   0.417463  1.0558       0.000103495  3.8074e-5   1.40033e-5\n",
       " 0.217275  0.568664  1.4013       7.44456e-5   2.73871e-5  1.00781e-5\n",
       " 0.298993  0.772255  1.83645      5.38255e-5   1.98014e-5  7.28114e-6\n",
       " 0.354921  0.899552  2.07896      4.55686e-5   1.67638e-5  6.20654e-6"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p = D, Φ, h, du, q, dq, du2, F_d, F_c, nx, xmin, xmax, ϵ \n",
    "rhs(u0, p, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  1.635984 seconds (3.06 M allocations: 250.078 MiB, 5.61% gc time)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "retcode: Success\n",
       "Interpolation: 1st order linear\n",
       "t: 2-element Array{Float64,1}:\n",
       " 0.0\n",
       " 0.5\n",
       "u: 2-element Array{Array{Float64,2},1}:\n",
       " [1.9866142981514303 1.964027580075817 … 4.52064859579604e-6 1.6630560553121398e-6; 1.9841114357936704 1.9573920254578652 … 3.8037319314288e-6 1.3993164595937913e-6; … ; 1.9696457715852267 1.919585740537372 … 1.9765045680131266e-6 7.271158501964692e-7; 1.964027580075817 1.9051482536448665 … 1.6630560553121398e-6 6.118044538760969e-7]        \n",
       " [1.999909257919542 1.9997530747473953 … 0.0006703577259757772 0.0002465313671577927; 1.9998920552072714 1.9997067588226982 … 0.0005643774009757945 0.00020768109928677567; … ; 1.9997923028304516 1.9994356969900715 … 0.00029331620535562043 0.000107933073992317; 1.9997533242256353 1.999329162009615 … 0.0002469127038351595 9.085450697358134e-5]"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tspan = (0.0, 0.5)\n",
    "p = D, Φ, h, du, q, dq, du2, F_d, F_c, nx, xmin, xmax, ϵ \n",
    "prob = ODEProblem(rhs, u0, tspan, p)\n",
    "@time uf = solve(prob,Tsit5(),save_everystep=false)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.0420973870706422e-5"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ue = @. -tanh((x + 0.5 - tspan[2])/(2*ϵ)) + 1.0\n",
    "error = norm(ue - uf[2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {
    "jupyter": {
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip5300\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip5300)\" d=\"\n",
       "M0 1600 L2400 1600 L2400 0 L0 0  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip5301\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip5300)\" d=\"\n",
       "M153.898 1487.47 L2352.76 1487.47 L2352.76 47.2441 L153.898 47.2441  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip5302\">\n",
       "    <rect x=\"153\" y=\"47\" width=\"2200\" height=\"1441\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  216.13,1487.47 216.13,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  734.728,1487.47 734.728,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1253.33,1487.47 1253.33,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1771.93,1487.47 1771.93,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2290.52,1487.47 2290.52,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,1446.78 2352.76,1446.78 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,1107.07 2352.76,1107.07 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,767.359 2352.76,767.359 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,427.652 2352.76,427.652 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,87.9437 2352.76,87.9437 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1487.47 2352.76,1487.47 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1487.47 153.898,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,1487.47 216.13,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  734.728,1487.47 734.728,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1253.33,1487.47 1253.33,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1771.93,1487.47 1771.93,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2290.52,1487.47 2290.52,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1446.78 180.284,1446.78 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1107.07 180.284,1107.07 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,767.359 180.284,767.359 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,427.652 180.284,427.652 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,87.9437 180.284,87.9437 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 216.13, 1541.47)\" x=\"216.13\" y=\"1541.47\">-1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 734.728, 1541.47)\" x=\"734.728\" y=\"1541.47\">-0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1253.33, 1541.47)\" x=\"1253.33\" y=\"1541.47\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1771.93, 1541.47)\" x=\"1771.93\" y=\"1541.47\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2290.52, 1541.47)\" x=\"2290.52\" y=\"1541.47\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 1464.28)\" x=\"129.898\" y=\"1464.28\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 1124.57)\" x=\"129.898\" y=\"1124.57\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 784.859)\" x=\"129.898\" y=\"784.859\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 445.152)\" x=\"129.898\" y=\"445.152\">1.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 105.444)\" x=\"129.898\" y=\"105.444\">2.0</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,88.0053 234.039,88.017 267.99,88.0454 301.94,88.0848 319.85,88.1113 319.85,88.1115 337.759,88.1429 371.709,88.2201 405.66,88.3271 423.569,88.3995 \n",
       "  423.569,88.3993 441.479,88.4853 475.429,88.6948 509.379,88.9856 527.289,89.1815 527.289,89.1819 545.199,89.4146 579.149,89.9836 613.099,90.7717 631.009,91.3038 \n",
       "  631.009,91.3034 648.918,91.9351 682.869,93.4741 716.819,95.6043 734.728,97.0374 734.728,97.0389 752.638,98.7383 786.588,102.873 820.538,108.567 838.448,112.384 \n",
       "  838.448,112.384 856.358,116.893 890.308,127.774 924.258,142.579 942.168,152.386 942.168,152.389 960.077,163.854 994.028,191.023 1027.98,226.857 1045.89,249.926 \n",
       "  1045.89,249.915 1063.8,276.221 1097.75,335.829 1131.7,409.133 1149.61,453.391 1149.61,453.388 1167.52,501.315 1201.47,600.957 1235.42,708.849 1253.33,767.348 \n",
       "  1253.33,767.371 1271.24,825.869 1305.19,933.762 1339.14,1033.4 1357.05,1081.33 1357.05,1081.33 1374.96,1125.59 1408.91,1198.89 1442.86,1258.5 1460.77,1284.8 \n",
       "  1460.77,1284.79 1478.68,1307.86 1512.63,1343.7 1546.58,1370.86 1564.49,1382.33 1564.49,1382.33 1582.4,1392.14 1616.35,1406.95 1650.3,1417.83 1668.21,1422.33 \n",
       "  1668.21,1422.34 1686.12,1426.15 1720.07,1431.85 1754.02,1435.98 1771.93,1437.68 1771.93,1437.68 1789.84,1439.11 1823.79,1441.24 1857.74,1442.78 1875.65,1443.42 \n",
       "  1875.65,1443.42 1893.55,1443.95 1927.51,1444.74 1961.46,1445.3 1979.36,1445.54 1979.36,1445.54 1997.27,1445.73 2031.22,1446.02 2065.18,1446.23 2083.08,1446.32 \n",
       "  2083.08,1446.32 2100.99,1446.39 2134.94,1446.5 2168.89,1446.58 2186.8,1446.61 2186.8,1446.61 2204.71,1446.63 2238.66,1446.67 2272.61,1446.7 2290.52,1446.71 \n",
       "  \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5302)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,88.0054 234.039,88.017 267.99,88.0454 301.94,88.0848 319.85,88.1114 337.759,88.143 371.709,88.2201 405.66,88.3271 423.569,88.3994 \n",
       "  441.479,88.4852 475.429,88.6948 509.379,88.9855 527.289,89.1817 545.199,89.4147 579.149,89.9835 613.099,90.7718 631.009,91.3036 \n",
       "  648.918,91.935 682.869,93.4743 716.819,95.604 734.728,97.0381 752.638,98.7386 786.588,102.873 820.538,108.567 838.448,112.384 \n",
       "  856.358,116.892 890.308,127.774 924.258,142.578 942.168,152.387 960.077,163.855 994.028,191.022 1027.98,226.859 1045.89,249.92 \n",
       "  1063.8,276.219 1097.75,335.829 1131.7,409.134 1149.61,453.39 1167.52,501.315 1201.47,600.958 1235.42,708.846 1253.33,767.359 \n",
       "  1271.24,825.873 1305.19,933.761 1339.14,1033.4 1357.05,1081.33 1374.96,1125.59 1408.91,1198.89 1442.86,1258.5 1460.77,1284.8 \n",
       "  1478.68,1307.86 1512.63,1343.7 1546.58,1370.86 1564.49,1382.33 1582.4,1392.14 1616.35,1406.94 1650.3,1417.83 1668.21,1422.33 \n",
       "  1686.12,1426.15 1720.07,1431.85 1754.02,1435.98 1771.93,1437.68 1789.84,1439.11 1823.79,1441.24 1857.74,1442.78 1875.65,1443.42 \n",
       "  1893.55,1443.95 1927.51,1444.74 1961.46,1445.3 1979.36,1445.54 1997.27,1445.73 2031.22,1446.02 2065.18,1446.23 2083.08,1446.32 \n",
       "  2100.99,1446.39 2134.94,1446.5 2168.89,1446.58 2186.8,1446.61 2204.71,1446.63 2238.66,1446.67 2272.61,1446.7 2290.52,1446.71 \n",
       "  \n",
       "  \"/>\n",
       "<path clip-path=\"url(#clip5300)\" d=\"\n",
       "M1989.93 312.204 L2280.76 312.204 L2280.76 130.764 L1989.93 130.764  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764 1989.93,312.204 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2013.93,191.244 2157.93,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2181.93, 208.744)\" x=\"2181.93\" y=\"208.744\">y1</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip5300)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2013.93,251.724 2157.93,251.724 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip5300)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2181.93, 269.224)\" x=\"2181.93\" y=\"269.224\">y2</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(x[:], uf[2][:])\n",
    "plot!(x[:],ue[:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  3.295961 seconds (7.25 M allocations: 386.589 MiB, 7.14% gc time)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "retcode: Success\n",
       "Interpolation: 1st order linear\n",
       "t: 2-element Array{Float64,1}:\n",
       " 0.0\n",
       " 0.5\n",
       "u: 2-element Array{Array{Float64,2},1}:\n",
       " [1.9866142981514303 1.964027580075817 … 4.52064859579604e-6 1.6630560553121398e-6; 1.9841114357936704 1.9573920254578652 … 3.8037319314288e-6 1.3993164595937913e-6; … ; 1.9696457715852267 1.919585740537372 … 1.9765045680131266e-6 7.271158501964692e-7; 1.964027580075817 1.9051482536448665 … 1.6630560553121398e-6 6.118044538760969e-7]          \n",
       " [1.9999127855955428 1.9997476431605556 … 0.0006695539913220822 0.00024634259844560447; 1.9998906195208943 1.9997116560616242 … 0.0005633504870023609 0.00020734269369324202; … ; 1.9997884302097462 1.999441109071406 … 0.00029277416149161347 0.00010786218105989721; 1.9997613160921925 1.99932779661034 … 0.0002464085932284685 9.077016059143436e-5]"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tspan = (0.0, 0.5)\n",
    "p = D, Φ, h, du, q, dq, du2, F_d, F_c, nx, xmin, xmax, ϵ \n",
    "prob = ODEProblem(rhs, u0, tspan, p)\n",
    "@time uf = solve(prob,CVODE_BDF(linear_solver=:GMRES),save_everystep=false)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0004464159228008807"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ue = @. -tanh((x + 0.5 - tspan[2])/(2*ϵ)) + 1.0\n",
    "error = norm(ue - uf[2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip6100\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip6100)\" d=\"\n",
       "M0 1600 L2400 1600 L2400 0 L0 0  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6101\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<path clip-path=\"url(#clip6100)\" d=\"\n",
       "M153.898 1487.47 L2352.76 1487.47 L2352.76 47.2441 L153.898 47.2441  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6102\">\n",
       "    <rect x=\"153\" y=\"47\" width=\"2200\" height=\"1441\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  216.13,1487.47 216.13,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  734.728,1487.47 734.728,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1253.33,1487.47 1253.33,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1771.93,1487.47 1771.93,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2290.52,1487.47 2290.52,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,1446.78 2352.76,1446.78 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,1107.07 2352.76,1107.07 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,767.361 2352.76,767.361 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,427.653 2352.76,427.653 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  153.898,87.9461 2352.76,87.9461 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1487.47 2352.76,1487.47 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1487.47 153.898,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,1487.47 216.13,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  734.728,1487.47 734.728,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1253.33,1487.47 1253.33,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1771.93,1487.47 1771.93,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2290.52,1487.47 2290.52,1470.19 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1446.78 180.284,1446.78 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,1107.07 180.284,1107.07 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,767.361 180.284,767.361 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,427.653 180.284,427.653 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  153.898,87.9461 180.284,87.9461 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 216.13, 1541.47)\" x=\"216.13\" y=\"1541.47\">-1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 734.728, 1541.47)\" x=\"734.728\" y=\"1541.47\">-0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1253.33, 1541.47)\" x=\"1253.33\" y=\"1541.47\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1771.93, 1541.47)\" x=\"1771.93\" y=\"1541.47\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2290.52, 1541.47)\" x=\"2290.52\" y=\"1541.47\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 1464.28)\" x=\"129.898\" y=\"1464.28\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 1124.57)\" x=\"129.898\" y=\"1124.57\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 784.861)\" x=\"129.898\" y=\"784.861\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 445.153)\" x=\"129.898\" y=\"445.153\">1.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 129.898, 105.446)\" x=\"129.898\" y=\"105.446\">2.0</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,88.0053 234.039,88.0204 267.99,88.0466 301.94,88.0898 319.85,88.1082 319.85,88.1175 337.759,88.142 371.709,88.2266 405.66,88.3258 423.569,88.4028 \n",
       "  423.569,88.3996 441.479,88.4913 475.429,88.698 509.379,88.9861 527.289,89.1949 527.289,89.1867 545.199,89.4244 579.149,89.9825 613.099,90.7866 631.009,91.3094 \n",
       "  631.009,91.3187 648.918,91.9358 682.869,93.4876 716.819,95.6186 734.728,97.0444 734.728,97.0478 752.638,98.7496 786.588,102.9 820.538,108.581 838.448,112.414 \n",
       "  838.448,112.4 856.358,116.929 890.308,127.803 924.258,142.615 942.168,152.433 942.168,152.432 960.077,163.899 994.028,191.058 1027.98,226.901 1045.89,249.959 \n",
       "  1045.89,249.953 1063.8,276.243 1097.75,335.84 1131.7,409.124 1149.61,453.362 1149.61,453.359 1167.52,501.272 1201.47,600.894 1235.42,708.762 1253.33,767.255 \n",
       "  1253.33,767.274 1271.24,825.775 1305.19,933.672 1339.14,1033.33 1357.05,1081.27 1357.05,1081.26 1374.96,1125.53 1408.91,1198.86 1442.86,1258.49 1460.77,1284.8 \n",
       "  1460.77,1284.79 1478.68,1307.87 1512.63,1343.71 1546.58,1370.88 1564.49,1382.35 1564.49,1382.35 1582.4,1392.16 1616.35,1406.97 1650.3,1417.85 1668.21,1422.35 \n",
       "  1668.21,1422.35 1686.12,1426.17 1720.07,1431.86 1754.02,1435.99 1771.93,1437.69 1771.93,1437.69 1789.84,1439.12 1823.79,1441.25 1857.74,1442.79 1875.65,1443.42 \n",
       "  1875.65,1443.42 1893.55,1443.95 1927.51,1444.74 1961.46,1445.31 1979.36,1445.54 1979.36,1445.54 1997.27,1445.74 2031.22,1446.03 2065.18,1446.23 2083.08,1446.32 \n",
       "  2083.08,1446.32 2100.99,1446.39 2134.94,1446.5 2168.89,1446.58 2186.8,1446.61 2186.8,1446.61 2204.71,1446.63 2238.66,1446.67 2272.61,1446.7 2290.52,1446.71 \n",
       "  \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6102)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  216.13,88.0078 234.039,88.0194 267.99,88.0478 301.94,88.0872 319.85,88.1138 337.759,88.1454 371.709,88.2225 405.66,88.3295 423.569,88.4018 \n",
       "  441.479,88.4876 475.429,88.6972 509.379,88.9879 527.289,89.184 545.199,89.4171 579.149,89.9859 613.099,90.7742 631.009,91.306 \n",
       "  648.918,91.9374 682.869,93.4767 716.819,95.6064 734.728,97.0405 752.638,98.741 786.588,102.875 820.538,108.569 838.448,112.386 \n",
       "  856.358,116.895 890.308,127.776 924.258,142.581 942.168,152.39 960.077,163.857 994.028,191.024 1027.98,226.861 1045.89,249.922 \n",
       "  1063.8,276.221 1097.75,335.831 1131.7,409.135 1149.61,453.392 1167.52,501.316 1201.47,600.959 1235.42,708.848 1253.33,767.361 \n",
       "  1271.24,825.874 1305.19,933.762 1339.14,1033.4 1357.05,1081.33 1374.96,1125.59 1408.91,1198.89 1442.86,1258.5 1460.77,1284.8 \n",
       "  1478.68,1307.86 1512.63,1343.7 1546.58,1370.86 1564.49,1382.33 1582.4,1392.14 1616.35,1406.94 1650.3,1417.83 1668.21,1422.33 \n",
       "  1686.12,1426.15 1720.07,1431.85 1754.02,1435.98 1771.93,1437.68 1789.84,1439.11 1823.79,1441.24 1857.74,1442.78 1875.65,1443.42 \n",
       "  1893.55,1443.95 1927.51,1444.74 1961.46,1445.3 1979.36,1445.54 1997.27,1445.73 2031.22,1446.02 2065.18,1446.23 2083.08,1446.32 \n",
       "  2100.99,1446.39 2134.94,1446.5 2168.89,1446.58 2186.8,1446.61 2204.71,1446.63 2238.66,1446.67 2272.61,1446.7 2290.52,1446.71 \n",
       "  \n",
       "  \"/>\n",
       "<path clip-path=\"url(#clip6100)\" d=\"\n",
       "M1989.93 312.204 L2280.76 312.204 L2280.76 130.764 L1989.93 130.764  Z\n",
       "  \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1989.93,312.204 2280.76,312.204 2280.76,130.764 1989.93,130.764 1989.93,312.204 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2013.93,191.244 2157.93,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2181.93, 208.744)\" x=\"2181.93\" y=\"208.744\">y1</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6100)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2013.93,251.724 2157.93,251.724 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6100)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2181.93, 269.224)\" x=\"2181.93\" y=\"269.224\">y2</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(x[:], uf[2][:])\n",
    "plot!(x[:],ue[:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.2.0",
   "language": "julia",
   "name": "julia-1.2"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
